<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e){
String userId = Request.QueryString["UID"];
String mode = Request.QueryString["MODE"];
string path = "Rioscan/" + userId;
path = mode.Equals("A") ? path + "_admin" : path ;
string filepath = Server.MapPath(path +".rioscan");   
// Create New instance of FileInfo class to get the properties of the file being downloaded   
FileInfo file = new FileInfo(filepath);   
// Clear the content of the response   
 Response.ClearContent();    
 // LINE1: Add the file name and attachment, which will force the open/cance/save dialog to show, to the header   
 // Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);    
 // Add the file size into the response header    
 Response.AddHeader("Content-Length", file.Length.ToString());    
 // Set the ContentType. function "ReturnExtension" return the proper content type and set it to the Response.ContentType property (not in this listing)    
 Response.ContentType = "application/rioscan";    
 // Write the file into the response (TransmitFile is for ASP.NET 2.0. In ASP.NET 1.1 you have to use WriteFile instead)    
 Response.TransmitFile(file.FullName);    
 // End the response    
 Response.End();
}
</script>
